﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chip8Dev.CPU
{
    public sealed class Instruction
    {
        public readonly NamedOpcode OpcodeName;
        public readonly Int32 InstructionBytes;
        public readonly Int32 Opcode;
        public readonly Int32 NNN;
        public readonly Int32 N;
        public readonly Int32 X;
        public readonly Int32 Y;
        public readonly Int32 KK;

        public Instruction(NamedOpcode opcodeName, Int32 instruction)
        {
            OpcodeName = opcodeName;
            InstructionBytes = instruction;
            Opcode = ((instruction & 0xF000) >> 12);
            NNN = (instruction & 0x0FFF);
            N = (instruction & 0x000F);
            X = ((instruction & 0x0F00) >> 8); 
            Y = ((instruction & 0x00F0) >> 4);
            KK = (instruction & 0x00FF);
        }
    }
}
